Skip to content

Commit 5d75038

Browse files
committed
Quick rewrite of dojo readme
1 parent d10ebc0 commit 5d75038

File tree

1 file changed

+54
-29
lines changed

1 file changed

+54
-29
lines changed

apps/dojo/README.md

Lines changed: 54 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,48 +22,73 @@ To run the Demo Viewer locally for development, follow these steps:
2222
brew install protobuf
2323
```
2424

25+
Note that running the dojo currently requires the use of `pnpm` (vs `yarn` or `npm`) do to how we handle workspace dependencies.
2526
```bash
26-
npm i turbo
27+
curl -fsSL https://get.pnpm.io/install.sh | sh -
2728
```
2829

29-
```bash
30-
curl -fsSL https://get.pnpm.io/install.sh | sh -
30+
The first time you want to run, you need to build all of the dojos dependencies throught the repository.
31+
```
32+
# from the ag-ui repository root
33+
pnpm i
34+
pnpm build --filter=demo-viewer
3135
```
3236

3337
### Run the Demo Viewer
3438

35-
In a new terminal, navigate to the project root and start the Demo Viewer:
39+
There are 3 ways to run the demo viewer
3640

37-
```bash
38-
pnpm install
39-
pnpm run dev
40-
```
41+
- Run just the demo viewer, and run the agent(s) separately
42+
- Run the dev script for the entire repo, and run the agent(s) separately
43+
- use the `dojo-everything` scripts
4144

42-
The Demo Viewer should now be running at [http://localhost:3000](http://localhost:3000).
45+
#### Run just the demo viewer, and run the agent(s) separately.
4346

44-
### Adding a new integration
47+
In one terminal, you can `cd` into the dojo directory and run `pnpm dev` to just run the dojo
48+
This will not capture updates to dependencies of the dojo
49+
In another terminal, you'll need to run any other agents you want to test separately, see "Run Agents" below.
50+
The dojo will start on port 3000 by default
51+
52+
Note that some agents may run on colliding ports
53+
54+
#### Run the dev script for the entire repo, and run the agent(s) separately
55+
In one terminal, you can run `pnpm dev` from the *repository root*
56+
This WILL automatically rebuild dependencies, for example if you change the mastra integration, it will automatically rebuild and be bundled into the dojo with HMR.
57+
In another terminal, you'll need to run any other agents you want to test separately, see "Run Agents" below.
58+
The dojo will start on port 3000 by default
4559

46-
On a fresh clone of this repo, you'll find that we've created a mock agent that represents all of the events needed to create an ACP compliant agent. To extend this to support
47-
your own integration, you'll need to:
60+
Note that some agents may run on colliding ports
4861

49-
1. Edit `src/examples/your-custom-http-agent.ts` to implement your own agent.
50-
2. Alternatively, edit `src/examples/your-custom-agent.ts` to implement a non http based integration.
51-
3. Read `src/app/api/sse/agentic_chat/route.ts` to understand what events need to be emitted on the agent side.
62+
#### Run Agents
63+
Agent examples for the dojo are generally located in `integrations/{integrationName}/{language}/examples`. A readme there should explain what you need to do to run the example, but it's usually either `npm dev` for typescript packages, or `poetry install && poetry run dev` or `uv sync && uv run dev` for python servers.
5264

53-
## Project Structure
65+
Note that some agents may run on colliding ports
5466

55-
- `src/examples` - Example agents
56-
- `src/app` - Next.js app router files
57-
- `src/components` - Reusable UI components
58-
- `src/demos` - Demo configuration and utilities
59-
- `src/hooks` - Custom React hooks
60-
- `src/types` - TypeScript type definitions
61-
- `public` - Static assets
67+
#### Use the `dojo-everything` scripts
6268

63-
## Technologies
69+
These are the easiest ways to run everything. They will automatically configure all of your ports to not be colliding, provide that information to the dojo, and spin up the dojo.
6470

65-
- Next.js
66-
- React
67-
- TypeScript
68-
- Tailwind CSS
69-
- CopilotKit
71+
```
72+
# In the apps/dojo directory
73+
./scripts/prep-dojo-everything.js
74+
./scripts/run-dojo-everything.js
75+
```
76+
77+
The demo viewer will now run on port 9999.
78+
79+
The one caveat here is that (for precompiled speed while running tests) this runs a production nextjs build, and that build has to be redone if you modify the dojo code at all (or any of the typescript integrations).
80+
81+
You can look in the `run-dojo-everything.js` script and see which ports it runs agents at, and export those as environment variables, which can be found in `apps/dojo/src/env.ts`. Then you can run the dojo via `pnpm dev` at the repo root, to get live updates to typescript integrations and the dojo. There is not HMR on most of the python framework agent examples.
82+
83+
To choose which agents or services the `run-dojo-everything.js` script runs you can use the `--only` flag, like this: `./scripts/run-dojo-everything.js --only adk-middleware,langgraph-fastapi`. The names for these IDs match what is in `src/agents.ts` as well as being findable in the run-dojo-everything script. .
84+
85+
### Adding a new integration
86+
Integrations should go in `integrations/{integrationID}`. There should always be a typescript folder that at least contains the client, and possibly a python (or other language) folder.
87+
88+
To add it to the dojo, please make sure it gets added to
89+
- src/agents.ts
90+
- src/menu.ts
91+
- scripts/prep-dojo-everything.js
92+
- scripts/run-dojo-everything.js
93+
- e2e.yml
94+
- the `apps/dojo/e2e` folder, look in the tests folder of other frameworks, and you should be able to mostly dupiclate these.

0 commit comments

Comments
 (0)