Thanks to visit codestin.com
Credit goes to github.com

Skip to content

TimPietrusky/agent0

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

agent0 banner

agent0 interacts with the world using one universal tool to rule them all: code.

the concrete tool is exec_ts and it can be used like this:

  • agent0 (x-ai/grok-code-fast-1) writes code in typescript on the fly to provide an answer to what ever prompt is given
  • the tool exec_ts runs the generated code in a e2b sandbox & provides the result back to the agent
  • agent0 can self-heal on errors, as it just fixes the code and runs exec_ts again
  • we define the context like apis to use (for example: use google rss for news)

this is a foundation. take it, adapt it, make it yours.

inspired by theo's video on Cloudflare's "code mode".

setup

1. install dependencies

pnpm install

2. get API keys and configure

cp .env.example .env

edit .env and add your keys:

required:

  • E2B_API_KEY - create account at https://e2b.dev (free tier: 500 executions/month)
  • OPENROUTER_API_KEY - create account at https://openrouter.ai (pay per use, ~$0.10/1M tokens for grok-code-fast-1)

optional:

3. start dev server

pnpm dev

launches Mastra with agent0

4. chat with agent0

open playground at http://localhost:4111, select agent0, start chatting.

try these prompts:

give me the top 5 news from germany today and the weather in berlin

show me the breaking 5 news from sf of today, the weather in berlin right now, and tell me what time it is in tokyo right now in relation to pt

APIs

(adapt these)

we include these as examples to show you how it works. replace them with APIs your agent needs:

to add your own: open src/mastra/agents/agent0.ts, scroll to the API section in the prompt, add:

### Your API Name
**Endpoint**: https://your-api.com/endpoint?param={value}
**Auth**: Header "Authorization: Bearer {YOUR_API_KEY}" (if needed)
**Returns**: { data: { field1, field2 } }

agent reads this, understands the API, writes code to use it. no code changes needed on our side. so provide the stuff that you think is the most important.

Tip

if it still does not work, then provide all the context for the given thing it is not doing correctly or switch to a smarter model.


this is your foundation. build on it.

About

use only one universal tool to rule them all: code

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •