Skip to content

yumosx/a2a-go

 
 

Repository files navigation

a2a-go

Agent-to-Agent Protocol Implementation for Go

how to use?

server

1. define Agent Card:

The AgentCard is the fundamental descriptor that defines an agent's identity, capabilities, and available skills.

var mockAgentCard = types.AgentCard{
	Name:        "test agent",
	Description: "a test agent for test",
	URL:         "http://localhost:8080/",
	Version:     "1.0",
	Capabilities: &types.AgentCapabilities{
		Streaming:              true,
		StateTransitionHistory: true,
	},
	Skills: []types.AgentSkill{
		{
			Id:          "test-skills",
			Name:        "test skill",
			Description: "a test skill for unit test",
			InputModes:  []string{"text/plain"},
		},
	},
}

2. define agent executor

type Executor struct{}

func NewExecutor() *Executor {
	return &Executor{}
}

func (e *Executor) Execute(ctx context.Context, requestContext *execution.RequestContext, queue *event.Queue) error {
	u := updater.NewTaskUpdater(queue, requestContext.TaskId, requestContext.ContextId)
	u.Complete(updater.WithFinal(true))
	return nil
}

func (e *Executor) Cancel(ctx context.Context, requestContext *execution.RequestContext, queue *event.Queue) error {
	u := updater.NewTaskUpdater(queue, requestContext.TaskId, requestContext.ContextId)
	u.Complete(updater.WithFinal(true))
	return nil
}

3. create a task store

4. start a server

client

install

About

a2a protocol implement by golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 99.6%
  • Makefile 0.4%